using UnityEngine;
using System.Collections;

public class EventEnablePerk : MonoBehaviour {

	GUIButton button;
	bool enabled;
	Color enabledColor = Color.green;
	Color disabledColor = Color.white;
	
	public Material materialEnabled;
	public Material materialDisabled;
	void Start ()
	{
		enabled = false;
		button = gameObject.GetComponent<GUIButton>();
		button.OnClickCallback += OnClick;
	}
	
	void OnClick(Vector3 pos){
		string perkName = 
			button.transform.parent.GetComponentInChildren<MyGUIText>().Text;
			
		Perks.PerkSet charPerks = 
			CharacterDataManager.GetInstance().GetCurrentCharData().perks;
/*		if (charPerks.UnEquip(perkName) ){
			this.GetComponent<GUIButton>().renderer.material = materialDisabled;
		}else if(charPerks.Equip(perkName) ){
			this.GetComponent<GUIButton>().renderer.material = materialEnabled;	
		}*/
		if (charPerks.UnEquip(perkName) );
		else
			charPerks.Equip(perkName);
		//button.transform.parent.transform.parent.GetComponent<GUIPanelPerks>().UpdatePoints();
	}
}
